﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EnterpriseCorpQualityForCpp.aspx.cs"
    Inherits="RN.ERP.Web.Enterprise.EnterpriseCorpQualityForCpp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>企业资质</title>
    <link href="../Styles/skins/blue/css/style.css" rel="stylesheet" type="text/css" />
    <link href="../Styles/skins/blue/css/style_msg.css" rel="stylesheet" type="text/css" />
    <link rel="Stylesheet" type="text/css" href="../Scripts/ligerUI/skins/Aqua/css/ligerui-all.css" />
    <link href="../Scripts/ligerUI/skins/Gray/css/layout.css" rel="stylesheet" type="text/css" />
    <link href="../Scripts/ligerUI/skins/Gray/css/tab.css" rel="stylesheet" type="text/css" />
    <link href="../Scripts/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../Scripts/jquery.min.js"></script>
    <script type="text/javascript" src="../Scripts/ligerUI/js/ligerui.min.js"></script>
    <link href="../Styles/imagesview.css" rel="stylesheet" type="text/css" />
    <script src="../Scripts/imagesview.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            var corpUserGuid = $("#hdnCorpUserGuid").val();
            BindQuality(corpUserGuid);
            //BindCorpZZImage(corpUserGuid);
        }
    );
    ////绑定企业资质
        function BindQuality(corpUserGuid) {
            var areaCode = $("#hdnAreaCode").val();
            $.getJSON("../Handlers/EnterpriseQualityInfoHandler.ashx", { "action": "Get", "data": corpUserGuid,"areaCode":areaCode, "rand": Math.random() }, function (data) {
                var result = eval(data);
                var innerHTML = "";
                $("#CorpQualities").empty();
                if (data != null && data.length > 0) {
                    for (var i = 0, j = data.length; i < j; i++) {
                        var item = data[i];
                        innerHTML += ' <tr><td><input  type="checkbox" id="' + item.QualityGuid + '"/></td>';

                        ////不可编辑则提供查看功能
                        var url = "<a href='javascript:void(0);' onclick='QualityDetail(\"" + item.QualityGuid + "\",\"" + item.CorpUserGuid + "\")'><span style=\"color: #43a9f5\">" + item.DetailName + "</span></a>";
                        innerHTML += '<td>' + (i + 1).toString() + '</td><td>' + url + '</td><td>'
                        + item.QualityCode + '</td><td>'
                        + item.GradeName + '</td><td>' + GetIsMain(item.IsMain) + '</td> <td>'
                        + GetString(item.GetDate).substr(0, GetString(item.GetDate).indexOf('T')) + '</td><td>'
                        + GetString(item.zzzEndDate).substr(0, GetString(item.zzzEndDate).indexOf('T'))
                        + '</td></tr>';
                    }
                }
                $("#CorpQualities").append(innerHTML);
            });
        }
        ////绑定资质扫描件
        function BindCorpZZImage(corpUserGuid) {
            var areaCode = $("#hdnAreaCode").val();
            $.post("../Handlers/EnterpriseCorpInfoHandler.ashx", { "action": "GetCorpZZImage", "data": corpUserGuid, "areaCode": areaCode, "rand": Math.random() }, function (data) {
                var result = eval(data);
                var mainQaulityGuid;
                if (result != null && result.length > 0) {
                    var obj = $("#divImages");
                    for (var i = 0; i < result.length; i++) {
                        var item = result[i];
                        var qualityGuid = item.QualityGuid;
                        mainQaulityGuid = item.QualityGuid;
                        var qualityName = item.DetailName;
                        var src = "../Handlers/GetFileHandler.ashx?fileName=" + qualityGuid + ".jpg&sysCode=EF&funcCode=CorpZZ&rand=" + Math.random();
                        var zzImage = "<div class='corpImages' except='except'><img  Class='pointer' src='" + src + "' onclick='ShowZZImage(\"" + qualityGuid + "\")' />" +
                "<div class='corpImagesTitle'><span>" + qualityName + "</span></div>" +
                "</div>";
                        obj.append(zzImage);
                    }
                }
                $("#QualityCodeImg").bind("click", function () {
                    ShowZZImage(mainQaulityGuid);
                });
            }, "json"
    );
        }
        function ShowZZImage(qualityGuid) {
            $.ligerDialog.open({ url: "UploadFileShowList.aspx?filename=" + qualityGuid + "&funcCode=CorpZZ&sysCode=EF&fileType=.jpg", width: 820, height: 650, title: '', isResize: true, buttons: [{ text: '关闭', onclick: function (item, dialog) { dialog.close(); } }] });
        }
        function GetString(obj) {
            if (obj == null || obj == undefined) {
                return '';
            }
            return obj;
        }
        function GetIsMain(isMain) {
            var title = "否";
            if (isMain != null && isMain == true) {
                title = "是";
            }
            return title;
        }
        function QualityDetail(qualityGuid, corpUserGuid) {
            //var areaCode = $("#hdnAreaCode").val();
            //$.ligerDialog.open({ url: "EnterpriseQualityInfoForCpp.aspx?OperateType=Edit&QualityGuid=" + qualityGuid + "&CorpUserGuid=" + corpUserGuid + "&rand=" + Math.random()+"&areaCode="+areaCode, width: 820, height: 700, title: '', buttons: [{ text: '关闭', onclick: function (item, dialog) { dialog.close(); } }] });
            //  window.radopen("EnterpriseQualityInfo.aspx?OperateType=Edit&QualityGuid=" + qualityGuid + "&CorpUserGuid=" + corpUserGuid + "&rand=" + Math.random(), "radWindowQuality");
            return false;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table width="100%" border="0" cellspacing="0" cellpadding="0" style="table-layout: fixed;
            border-collapse: collapse; padding: 0">
            <tr>
                <td class="xx_m  tt_xx_l">
                </td>
                <td class="xx_m  tt_xx_icon">
                </td>
                <td style="width: auto;" class="xx_m">
                    <asp:Literal ID="ltrCorpName" runat="server"></asp:Literal>
                </td>
                <td style="width: 14px;">
                    <img src="../images/xx_r.jpg" width="14" height="33" />
                </td>
            </tr>
            <tr>
                <td class="left_con">
                </td>
                <td colspan="2" style="padding-left: 6px; padding-right: 6px;" valign="top">
                    <div style="zoom: 1; overflow: hidden">
                        <div class="xian">
                            <div class="about_title">
                                企业资质信息</div>
                        </div>
                        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab">
                            <tr>
                                <th bgcolor="#f2f2f2">
                                    <strong></strong>
                                </th>
                                <th bgcolor="#f2f2f2">
                                    <strong>序号</strong>
                                </th>
                                <th bgcolor="#f2f2f2">
                                    <strong>资质名称</strong>
                                </th>
                                <th bgcolor="#f2f2f2">
                                    <strong>资质证书编号</strong>
                                </th>
                                <th bgcolor="#f2f2f2">
                                    <strong>资质等级</strong>
                                </th>
                                <th bgcolor="#f2f2f2">
                                    <strong>主项资质</strong>
                                </th>
                                <th bgcolor="#f2f2f2">
                                    <strong>发证日期</strong>
                                </th>
                                <th bgcolor="#f2f2f2">
                                    <strong>有效期至</strong>
                                </th>
                            </tr>
                            <tbody id="CorpQualities">
                            </tbody>
                        </table>
                    </div>

                    <!--企业相关证件扫描件-->
                    <div class="hx_bg">
                    </div>
                    <div>
                        <div class="xian">
                            <div class="about_title">
                                证件扫描件</div>
                        </div>
                    </div>
                    <div id="divImages">
                    <asp:Repeater ID="rptImgs" runat="server">
                        <ItemTemplate>
                            <div class="corpImages">
                                <a href='<%# OpenNewPageShowFile(Container.DataItem.ToString()) %>' target="_blank" title="图片查看">
                                    <asp:Image ID="imgCorpOrg" runat="server" CssClass="pointer" FuncCode="CorpORG" sysCode="EF"
                                        checkempty="yes" ImageUrl='<%# GetImgUrl(Container.DataItem.ToString()) %>' />
                                    <div class="corpImagesTitle">
                                        <span>扫描件<%# Container.ItemIndex+1 %></span></div>
                                </a>
                            </div>
                        </ItemTemplate>
                    </asp:Repeater>
                </div>
                    <div class="hx_bg">
                    </div>
                </td>
                <td class="right_con">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="con_m tt_left_bottom">
                    &nbsp;
                </td>
                <td colspan="2" class="con_m">
                    &nbsp;
                </td>
                <td class="tt_right_bottom">
                    &nbsp;
                </td>
            </tr>
        </table>
    </div>
    <asp:HiddenField ID="hdnCorpUserGuid" runat="server" Value="0" />
    <asp:HiddenField ID="hdnAreaCode" runat="server" Value="0" />
    </form>
</body>
</html>
